package Interface;

import Book.Book;
import Book.BookList;

import java.util.Scanner;

/**
 * @Author YuanYuan
 * @Date 2022/5/18
 * @Time 10:38
 */
public class AddBook implements INterface {

    @Override
    public void work(BookList bookList) {
        System.out.println("添加图书");
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入图书名->");
        String name = scanner.nextLine();
        System.out.print("请输入作者->");
        String author = scanner.nextLine();
        System.out.print("请输入价格->");
        double price = scanner.nextDouble();

        Book book = new Book(name,author,price);
        bookList.setBooks(bookList.getNumber(),book);
        int num = bookList.getNumber()+1;
        bookList.setNumber(num);
    }
}
